$$ list.tpl
$$
$$ Java GUI函数库模板
$$

statement: 新建一个窗体 ->
(jnew (jconstructor "javax.swing.JFrame"))

statement: 为窗体{frame}设置关闭按钮 ->
(jcall (jmethod "javax.swing.JFrame" "setDefaultCloseOperation" "int") 
	{frame} 3)

statement: 为窗体 {frame}设置标题{t} ->
(jcall (jmethod "java.awt.Frame" "setTitle" "java.lang.String") 
	{frame} {t})

statement: 为窗体 {frame}设置宽度{w}和高度{h} ->
(jcall (jmethod "java.awt.Window" "setSize" "int" "int") 
	{frame} {w} {h})

statement: 为窗体 {frame}设置位置({x},{y}) ->
(jcall (jmethod "java.awt.Window" "setLocation" "int" "int") 
	{frame} {x} {y})

statement: 为窗体 {frame}设置边界({x},{y},{w},{h}) ->
(jcall (jmethod "java.awt.Window" "setBounds" "int" "int" "int" "int") 
	{frame} {x} {y} {w} {h})

statement: 显示窗体 {frame} ->
(jcall (jmethod "java.awt.Window" "setVisible" "boolean") 
	{frame} +true+)

statement: 隐藏窗体 {frame} ->
(jcall (jmethod "java.awt.Window" "setVisible" "boolean") 
	{frame} +false+)

statement: 获得窗体 {frame}的位置 ->
(jcall (jmethod "java.awt.Window" "getLocation") {frame})

statement: 获得窗体 {frame}的大小 ->
(jcall (jmethod "java.awt.Window" "getSize") {frame})

statement: 将窗体 {frame}移到前面 ->
(jcall (jmethod "java.awt.Window" "toFront") {frame})

statement: 将窗体 {frame}移到后面 ->
(jcall (jmethod "java.awt.Window" "toBack") {frame})

statement: 将窗体 {frame}设为可调整大小 ->
(jcall (jmethod "java.awt.Frame" "setResizable" "boolean") 
	{frame} +true+)

statement: 将窗体 {frame}设为不可调整大小 ->
(jcall (jmethod "java.awt.Frame" "setResizable" "boolean") 
	{frame} +false+)

statement: 为窗体 {frame}设置图标{icon} ->
(jcall (jmethod "java.awt.Frame" "setIconImage" "java.awt.Image") 
	{frame} {icon})

statement: 调整{component}至屏幕中央 ->
(let* ( (toolkit (jstatic "getDefaultToolkit" "java.awt.Toolkit"))
	(screenSize (jcall (jmethod "java.awt.Toolkit" "getScreenSize") toolkit))
	(sWidth (jcall (jmethod "java.awt.Dimension" "getWidth") screenSize))
	(sHeight (jcall (jmethod "java.awt.Dimension" "getHeight") screenSize))
	(width (jcall (jmethod "java.awt.Component" "getWidth") {component}))
	(height (jcall (jmethod "java.awt.Component" "getHeight") {component})) )
	(jcall (jmethod "java.awt.Component" "setLocation" "int" "int") {component} 
	(floor (/ (- sWidth width) 2)) (floor (/ (- sHeight height) 2)) ))












